<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="com.css" type="text/css">
</head>

<body>
    <div id="app">
        <img :src="imgUrl" alt="">
        <div :class="clsProp">
            <h1>aaaa</h1>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    
    <script>
        var app = new Vue({
            el:'#app',
            data:{
                imgUrl:'https://img01.sogoucdn.com/app/a/100520024/6bea3363c91f94d8337ac44a480f8368',
                hasColor:true,
                hasNum:false,
                // bgcolorCls:this.hasColor?'bgcolor':'',
                colorCls:'forecolor'
            },
            computed:{
                bgcolorCls:function(){
                    return this.hasColor?'bgcolor':''
                },
                clsProp:function(){
                    return{
                        bgcolor:this.hasColor,
                        forecolor:this.hasNum
                    }
                }
            }
        })
    </script>

</body>

</html>